import { Injectable } from '@angular/core';
import { OutsourcingDto } from '@shared/service-proxies/service-proxies';

@Injectable({
    providedIn: 'root'
})
export class TaskService {
    items = [];
    constructor() {}

    addToCart(task) {
        this.items.push(task);
    }

    getItesm() {
        return this.items;
    }

    clearCart() {
        this.items = [];
        return this.items;
    }


    public outsourcings : Array<OutsourcingDto> = new Array<OutsourcingDto>();
    addToOutsourcs(outsourcing) {
      let _outsourcing =  this.outsourcings.filter(x => x.taskForModelId === outsourcing.taskForModelId)[0];
        if ( _outsourcing === undefined) {
            this.outsourcings.push(outsourcing);
        }
    }
    removeOutSourcing(outsourcing)
    {
        //this.outsourcings.indexOf()
    }

    clearOutSourcs() {
        this.outsourcings = [];
        return this.outsourcings;
    }
    getOutSourcings() {
        return this.outsourcings;
    }



}
